package com.renderbus.ep;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import node.NodeImitator;

public class RootMain {
	
	public static void main(String[] args) {
		
		int count = 100;
		//启动nodes服务线程
		for(int i = 0;i < count;i++){
			NodeImitator ni = new  NodeImitator("127.0.0.1", i+7000);
			ni.start();
		}
		//启动连接nodes服务
		for(int i = 0;i < count;i++){
			NodeClient nc = new  NodeClient("127.0.0.1", i+7000);
			nc.start();
		}
		ServerSocket ss = null;
		try {
			ss = new  ServerSocket(8888);
			Socket s = null;
			while(true){
				s = ss.accept();
				new SocketThread(s).run();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	
}
